package kibahed.university.effizientealgorithmen.abstractclasses;

import java.awt.geom.Point2D;

import kibahed.university.effizientealgorithmen.interfaces.IVertexPlanarDouble;

/**
 * 
 * @author Bernhard Kinast
 * @author Daniel Heily
 *
 */

public abstract class AVertexDouble extends AVertex implements IVertexPlanarDouble{
	
	Point2D.Double positionDouble = new Point2D.Double();

	@Override
	public void setPosition(double x, double y) {
		positionDouble.setLocation(x, y);
	}

	@Override
	public void setPosition(Point2D.Double position) {
		positionDouble.setLocation(position);
	}

	@Override
	public Point2D.Double getPositionDouble() {
		return positionDouble;
	}

	@Override
	public double getXDouble() {
		return positionDouble.getX();
	}

	@Override
	public double getYDouble() {
		return positionDouble.getY();
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((positionDouble == null) ? 0 : positionDouble.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		AVertexDouble other = (AVertexDouble) obj;
		if (positionDouble == null) {
			if (other.positionDouble != null)
				return false;
		} else if (!positionDouble.equals(other.positionDouble))
			return false;
		return true;
	}

	

}
